Kanzi 4.0.0-beta2
Functions
Collaboration diagram for Functions:

Functions

template<typename T >
span< Tkanzi::gfx::allocateCommandBufferCommands (const CommandBufferHandleGuard &handle, uint32_t count)
 Allocates typed command buffer memory.
 
KANZI_GFX_API span< byte > kanzi::gfx::allocateCommandBufferMemory (const CommandBufferHandleGuard &handle, uint32_t size)
 Allocates raw memory into a command buffer.
 
constexpr v2u32 kanzi::gfx::calculateDimensionsForMip (v2u32 dims, uint8_t mip)
 Calculates the dimensions of a 2-dimensional mip level.
 
constexpr v3u32 kanzi::gfx::calculateDimensionsForMip (v3u32 dims, uint8_t mip)
 Calculates the dimensions of a 3-dimensional mip level.
 
KANZI_GFX_API HandleGuard< BlendStateHandlekanzi::gfx::create (const BlendStateCreateInfo &info)
 Creates a blend state graphics object.
 
KANZI_GFX_API HandleGuard< BufferHandlekanzi::gfx::create (const BufferCreateInfo &info)
 Creates a buffer graphics object.
 
KANZI_GFX_API HandleGuard< CommandBufferHandlekanzi::gfx::create (const CommandBufferCreateInfo &info)
 Creates a command buffer graphics object.
 
KANZI_GFX_API HandleGuard< ComputePipelineHandlekanzi::gfx::create (const ComputePipelineCreateInfo &info)
 Creates a compute pipeline graphics object.
 
KANZI_GFX_API HandleGuard< ComputeResourceSetHandlekanzi::gfx::create (const ComputeResourceSetCreateInfo &info)
 Creates a compute resource set graphics object.
 
KANZI_GFX_API HandleGuard< DepthStencilStateHandlekanzi::gfx::create (const DepthStencilStateCreateInfo &info)
 Creates a depth stencil state graphics object.
 
KANZI_GFX_API HandleGuard< FrameBufferHandlekanzi::gfx::create (const FrameBufferCreateInfo &info)
 Creates a frame buffer graphics object.
 
KANZI_GFX_API HandleGuard< GpuFenceHandlekanzi::gfx::create (const GpuFenceCreateInfo &info)
 Creates a GPU fence graphics object.
 
KANZI_GFX_API HandleGuard< ImageHandlekanzi::gfx::create (const ImageCreateInfo &info)
 Creates an image graphics object.
 
KANZI_GFX_API HandleGuard< RasterStateHandlekanzi::gfx::create (const RasterStateCreateInfo &info)
 Creates a raster state graphics object.
 
KANZI_GFX_API HandleGuard< RenderPassHandlekanzi::gfx::create (const RenderPassCreateInfo &info)
 Creates a render pass graphics object.
 
KANZI_GFX_API HandleGuard< RenderPipelineHandlekanzi::gfx::create (const RenderPipelineCreateInfo &info)
 Creates a render pipeline graphics object.
 
KANZI_GFX_API HandleGuard< RenderResourceSetHandlekanzi::gfx::create (const RenderResourceSetCreateInfo &info)
 Creates a render resource set graphics object.
 
KANZI_GFX_API HandleGuard< SamplerHandlekanzi::gfx::create (const SamplerCreateInfo &info)
 Creates a sampler graphics object.
 
KANZI_GFX_API HandleGuard< ShaderHandlekanzi::gfx::create (const ShaderCreateInfo &info)
 Creates a shader graphics object.
 
KANZI_GFX_API HandleGuard< VertexInputStateHandlekanzi::gfx::create (const VertexInputStateCreateInfo &info)
 Creates a vertex input state graphics object.
 
KANZI_GFX_API ChannelType kanzi::gfx::formatToChannelType (Format format)
 Gets the channel encoding type for a graphics format.
 
KANZI_GFX_API BackendInformation kanzi::gfx::getBackendInformation ()
 Gets information about the current backend.
 
KANZI_GFX_API v2u8 kanzi::gfx::getBlockSize (Format format)
 Gets the block size in pixels of a compressed format.
 
KANZI_GFX_API uint32_t kanzi::gfx::getBlockStride (Format format)
 Gets the block stride in bytes for a compressed graphics format.
 
KANZI_GFX_API uint32_t kanzi::gfx::getChannelCount (Format format)
 Gets the number of color and alpha channels in a graphics format.
 
KANZI_GFX_API v4u8 kanzi::gfx::getColorBits (Format format)
 Gets the number of bits used to represent each color and alpha channel.
 
KANZI_GFX_API v2u8 kanzi::gfx::getDepthStencilBits (Format format)
 Gets the number of bits used to represent each depth and stencil channel.
 
KANZI_GFX_API uint32_t kanzi::gfx::getDeviceProperty (DevicePropertyId property)
 Gets the value of a property for the current device.
 
uint8_t kanzi::gfx::getFaceCount (gfx::ImageType type)
 Gets the face count for a given resource type.
 
KANZI_GFX_API AspectMask kanzi::gfx::getFormatAspects (Format format)
 Gets the aspect mask for a given graphics format.
 
KANZI_GFX_API FormatFeatureFlag kanzi::gfx::getFormatFeatures (Format format)
 Gets device feature flags for a format for the current backend and device.
 
KANZI_GFX_API AttachmentDescriptionSet kanzi::gfx::getFrameBufferAttachmentDescriptionSet (const FrameBufferHandleGuard &handle)
 Gets a default frame buffer attachment description set that is compatible with a frame buffer.
 
KANZI_GFX_API size_t kanzi::gfx::getImageSize (Format format, v3u32 dimensions)
 Gets the size in bytes of an image with the specified format and dimensions.
 
uint32_t kanzi::gfx::getIndexBufferStride (IndexBufferType type)
 Gets the stride in bytes of an index buffer type.
 
KANZI_GFX_API uint32_t kanzi::gfx::getPixelStride (Format format)
 Gets the pixel stride in bytes for an uncompressed graphics format.
 
constexpr ShaderFormatFamily kanzi::gfx::getShaderFormatFamily (ShaderFormat format)
 Gets the Shader format family for a given shader format.
 
KANZI_GFX_API ObjectStatus kanzi::gfx::getStatus (const RenderPipelineHandleGuard &handle)
 Gets the status of a render pipeline graphics object.
 
KANZI_GFX_API ObjectStatus kanzi::gfx::getStatus (const ShaderHandleGuard &handle)
 Gets the status of a shader graphics object.
 
KANZI_GFX_API platform::SurfaceBits kanzi::gfx::getSurfaceBitsFromFormat (Format color, Format depthStencil=Format::None)
 Converts a color and depth stencil Format into a SurfaceBits structure.
 
KANZI_GFX_API bool kanzi::gfx::initialize (const InitializationInfo &info)
 Initializes the Kanzi graphics library.
 
KANZI_GFX_API bool kanzi::gfx::isAlpha (Format format)
 Returns whether a graphics format contains an alpha channel.
 
KANZI_GFX_API bool kanzi::gfx::isAstcHdrCompressed (Format format)
 Returns whether a graphics format is ASTC HDR compressed.
 
KANZI_GFX_API bool kanzi::gfx::isColor (Format format)
 Returns whether a graphics format contains a color channel.
 
KANZI_GFX_API bool kanzi::gfx::isCompressed (Format format)
 Returns whether a graphics format is compressed.
 
KANZI_GFX_API bool kanzi::gfx::isDepth (Format format)
 Returns whether a graphics format contains a depth channel.
 
KANZI_GFX_API bool kanzi::gfx::isFeatureEnabled (FeatureId feature)
 Returns whether a graphics feature is supported by the current backend and device.
 
KANZI_GFX_API bool kanzi::gfx::isInitialized ()
 Returns whether the graphics library is initialized.
 
KANZI_GFX_API bool kanzi::gfx::isNativeTextureHandleTypeSupported (const gfx::NativeTextureHandle &handle)
 Returns whether a native handle type for texture is supported by the current backend.
 
KANZI_GFX_API bool kanzi::gfx::isShaderFormatSupported (ShaderFormat format)
 Returns whether a shader format is supported by the current backend and device.
 
KANZI_GFX_API bool kanzi::gfx::isSRGBEncoded (Format format)
 Returns whether the color channels of a graphics format are sRGB-encoded.
 
KANZI_GFX_API bool kanzi::gfx::isStencil (Format format)
 Returns whether a graphics format contains a stencil channel.
 
KANZI_GFX_API span< byte > kanzi::gfx::mapBuffer (const BufferHandleGuard &handle, uint32_t offset=0, uint32_t size=limits::MaxBufferSize)
 Maps buffer memory into CPU-addressable memory for reading or writing.
 
KANZI_GFX_API string kanzi::gfx::outputCommandBuffer (DebugInformation &debugInformation, const CommandBufferHandleGuard &commandBuffer)
 Outputs the contents of a command buffer into a string.
 
KANZI_GFX_API span< const byte > kanzi::gfx::peekCommandBufferMemory (const CommandBufferHandleGuard &handle)
 Peeks at the currently allocated memory inside a command buffer.
 
KANZI_GFX_API void kanzi::gfx::processCommands (CommandBufferHandleGuard commands, TaskFn callback={})
 Notifies the backend to start processing the commands within a command buffer.
 
KANZI_GFX_API void kanzi::gfx::resetGpuFence (const GpuFenceHandleGuard &handle)
 Resets the state of a GPU fence so that it can be used again.
 
KANZI_GFX_API void kanzi::gfx::shutdown ()
 Shuts down the graphics library.
 
KANZI_GFX_API FixedString kanzi::gfx::toFixedString (FilterMode filter)
 Gets a string representation of a filter mode.
 
KANZI_GFX_API string kanzi::gfx::toString (DevicePropertyId propertyId)
 Gets the device property identifier as a string.
 
KANZI_GFX_API string kanzi::gfx::toString (FeatureId feature)
 Gets the Feature identifier as a string.
 
KANZI_GFX_API string kanzi::gfx::toString (ShaderFormat format)
 Gets the shader format as a string.
 
KANZI_GFX_API string kanzi::gfx::toString (ShaderStage stage)
 Gets the shader stage as a string.
 
Format kanzi::gfx::tryGetDepthStencilFromSurfaceBits (const platform::SurfaceBits &properties)
 Matches a SurfaceBits structure to a depth stencil graphics format.
 
Format kanzi::gfx::tryGetFormatFromSurfaceBits (const platform::SurfaceBits &properties)
 Matches a SurfaceBits structure to a graphics format.
 
KANZI_GFX_API void kanzi::gfx::unmapBuffer (const BufferHandleGuard &handle)
 Unmaps buffer memory from CPU-addressable memory.
 
KANZI_GFX_API void kanzi::gfx::unmapBuffer (const BufferHandleGuard &handle, span< ByteRange > updatedRanges)
 Unmaps buffer memory from CPU-addressable memory.
 
KANZI_GFX_API void kanzi::gfx::updateSurfaceDimensions (const FrameBufferHandleGuard &handle, v2u32 dimensions)
 Updates the dimensions for a frame buffer that was created as an on-screen surface.
 
template<typename T_Func >
void kanzi::gfx::visitCommands (const span< const byte > &commandMemory, T_Func &&func)
 Traverses the command memory.
 
KANZI_GFX_API WaitResult kanzi::gfx::waitForGpuFence (const GpuFenceHandleGuard &handle, chrono::nanoseconds timeout)
 Blocks the current thread until the GPU fence has been signaled or the timeout occurs.
 

Detailed Description

The functions of the graphics libraries.

Function Documentation

◆ outputCommandBuffer()

KANZI_GFX_API string kanzi::gfx::outputCommandBuffer ( DebugInformation & debugInformation,
const CommandBufferHandleGuard & commandBuffer )

Outputs the contents of a command buffer into a string.

Used for debugging purposes to understand generated Kanzi graphics commands.

Parameters
debugInformationA refrence to the DebugInformation interface.
commandBufferThe command buffer to output.
Returns
The string representation of a command buffer.
Since
Kanzi 4.0.0

◆ initialize()

KANZI_GFX_API bool kanzi::gfx::initialize ( const InitializationInfo & info)

Initializes the Kanzi graphics library.

You must call this function before all other graphics APIs.

Parameters
infoThe graphics common initialization information.
Returns
If initialization was successful, true, otherwise false.
Since
Kanzi 4.0.0

◆ shutdown()

KANZI_GFX_API void kanzi::gfx::shutdown ( )

Shuts down the graphics library.

When you call this function, make sure that:

  • You freed all graphics objects that you created.
  • There is no concurrent processing of commands.
    Since
    Kanzi 4.0.0

◆ isInitialized()

KANZI_GFX_API bool kanzi::gfx::isInitialized ( )

Returns whether the graphics library is initialized.

You can call this function from any thread.

Returns
If the graphics library is initialized, true, otherwise false.
Since
Kanzi 4.0.0

◆ getBackendInformation()

KANZI_GFX_API BackendInformation kanzi::gfx::getBackendInformation ( )

Gets information about the current backend.

You can call this function from any thread.

Returns
The information about the current backend.
Since
Kanzi 4.0.0

◆ isShaderFormatSupported()

KANZI_GFX_API bool kanzi::gfx::isShaderFormatSupported ( ShaderFormat format)

Returns whether a shader format is supported by the current backend and device.

You can call this function from any thread.

Parameters
formatThe shader format.
Returns
If the current backend and device support the shader format, true, otherwise false.
Since
Kanzi 4.0.0

◆ isNativeTextureHandleTypeSupported()

KANZI_GFX_API bool kanzi::gfx::isNativeTextureHandleTypeSupported ( const gfx::NativeTextureHandle & handle)

Returns whether a native handle type for texture is supported by the current backend.

Parameters
handleThe native texture handle.
Returns
If the current backend support the native handle format, true, otherwise false.
Since
Kanzi 4.0.0

◆ getDeviceProperty()

KANZI_GFX_API uint32_t kanzi::gfx::getDeviceProperty ( DevicePropertyId property)

Gets the value of a property for the current device.

These properties are fixed at runtime by the backend and the running device. You can call this function from any thread.

Parameters
propertyThe identifier of the device property.
Returns
The value of the requested property.
Since
Kanzi 4.0.0

◆ isFeatureEnabled()

KANZI_GFX_API bool kanzi::gfx::isFeatureEnabled ( FeatureId feature)

Returns whether a graphics feature is supported by the current backend and device.

You can call this function from any thread.

Parameters
featureThe identifier of the feature.
Returns
If the current backend and device support the feature, true, otherwise false.
Since
Kanzi 4.0.0

◆ getFormatFeatures()

KANZI_GFX_API FormatFeatureFlag kanzi::gfx::getFormatFeatures ( Format format)

Gets device feature flags for a format for the current backend and device.

You can call this function from any thread.

Parameters
formatThe image format.
Returns
Feature flags for the image format.
Since
Kanzi 4.0.0

◆ getFrameBufferAttachmentDescriptionSet()

KANZI_GFX_API AttachmentDescriptionSet kanzi::gfx::getFrameBufferAttachmentDescriptionSet ( const FrameBufferHandleGuard & handle)

Gets a default frame buffer attachment description set that is compatible with a frame buffer.

When creating an on-screen surface, there is no guarantee that the platform supports the requested format. The attachment description set returned by this function contains the format that the surface really uses. You can call this function from any thread.

Parameters
handleThe frame buffer handle.
Returns
The attachment description set.
Since
Kanzi 4.0.0

◆ updateSurfaceDimensions()

KANZI_GFX_API void kanzi::gfx::updateSurfaceDimensions ( const FrameBufferHandleGuard & handle,
v2u32 dimensions )

Updates the dimensions for a frame buffer that was created as an on-screen surface.

Call this function to update the backend when the size of the surface changes. You can call this function from any thread.

Parameters
handleThe frame buffer handle.
dimensionsThe window dimensions in pixels.
Since
Kanzi 4.0.0

◆ waitForGpuFence()

KANZI_GFX_API WaitResult kanzi::gfx::waitForGpuFence ( const GpuFenceHandleGuard & handle,
chrono::nanoseconds timeout )

Blocks the current thread until the GPU fence has been signaled or the timeout occurs.

The GPU fence is not automatically reset, which is why a second wait on a signaled fence always returns immediately. You can call this function from any thread.

Parameters
handleThe GPU fence handle.
timeoutThe duration to wait before a timeout occurs.
Returns
The result of the wait operation. Indicates success or timeout.
Since
Kanzi 4.0.0

◆ resetGpuFence()

KANZI_GFX_API void kanzi::gfx::resetGpuFence ( const GpuFenceHandleGuard & handle)

Resets the state of a GPU fence so that it can be used again.

You can call this function from any thread.

Parameters
handleThe GPU fence handle.
Since
Kanzi 4.0.0

◆ allocateCommandBufferMemory()

KANZI_GFX_API span< byte > kanzi::gfx::allocateCommandBufferMemory ( const CommandBufferHandleGuard & handle,
uint32_t size )

Allocates raw memory into a command buffer.

Once allocated, you must fill the buffer with command data before processing. It is recommended to use the typed helper function, see the allocateCommandBufferCommands function. You can call this function from any thread. It is unsupported to allocate memory from the same command buffer from multiple threads at the same time.

Parameters
handleThe command buffer handle.
sizeThe size of memory to allocate in bytes.
Returns
A span of bytes that were allocated from the command buffer.
Since
Kanzi 4.0.0

◆ allocateCommandBufferCommands()

template<typename T >
span< T > kanzi::gfx::allocateCommandBufferCommands ( const CommandBufferHandleGuard & handle,
uint32_t count )

Allocates typed command buffer memory.

This automatically initializes command data with the specified type. The type must be a graphics command type, or a composite type of only graphics commands. You can call this function from any thread. It is unsupported to allocate memory from the same command buffer from multiple threads at the same time.

Parameters
handleThe buffer handle.
countThe number of instances of the type to allocate.
Template Parameters
TThe type to use to initialize the allocated memory. This can be a graphics command type or a composite type of only graphics commands.
Returns
A span of typed objects that were allocated in the command buffer.
Since
Kanzi 4.0.0

◆ processCommands()

KANZI_GFX_API void kanzi::gfx::processCommands ( CommandBufferHandleGuard commands,
TaskFn callback = {} )

Notifies the backend to start processing the commands within a command buffer.

This is an asynchronous operation and may not be complete when this function returns. The callback function is called on an undefined thread when the command processing is complete. You can call this function from any thread.

Parameters
commandsThe command buffer to process.
callbackThe callback function that is called when the processing is complete.
Since
Kanzi 4.0.0

◆ mapBuffer()

KANZI_GFX_API span< byte > kanzi::gfx::mapBuffer ( const BufferHandleGuard & handle,
uint32_t offset = 0,
uint32_t size = limits::MaxBufferSize )

Maps buffer memory into CPU-addressable memory for reading or writing.

The buffer must be created with the CPUAccessFlag::Read or CPUAccessFlag::Write. Make sure that all calls to this function have a corresponding call to gfx::unmapBuffer. A buffer can have only one mapping at a time.

You can call this function from any thread with distinct buffer handles. Calls with the same buffer handle must be externally synchronized.

Parameters
handleThe buffer handle.
offsetThe offset in bytes to map.
sizeThe size in bytes to map. The default is the rest of the buffer.
Returns
A span of bytes that represents the buffer contents.
Since
Kanzi 4.0.0

◆ unmapBuffer() [1/2]

KANZI_GFX_API void kanzi::gfx::unmapBuffer ( const BufferHandleGuard & handle)

Unmaps buffer memory from CPU-addressable memory.

You can use this on a buffer that you mapped with the gfx::mapBuffer function.

This overload assumes that the entire mapped region has been modified. If you only modified a part of the mapped region, you can specify the ranges that were modified using the overload of this function that takes a span of ByteRange.

You can call this function from any thread with distinct buffer handles. Calls with the same buffer handle must be externally synchronized.

Parameters
handleThe buffer handle. is considered to have been updated.
Since
Kanzi 4.0.0

◆ unmapBuffer() [2/2]

KANZI_GFX_API void kanzi::gfx::unmapBuffer ( const BufferHandleGuard & handle,
span< ByteRange > updatedRanges )

Unmaps buffer memory from CPU-addressable memory.

You can use this on a buffer that you mapped with the gfx::mapBuffer function.

Only the memory ranges specified in the updatedRanges parameter are considered to have been modified.

You can call this function from any thread with distinct buffer handles. Calls with the same buffer handle must be externally synchronized.

Parameters
handleThe buffer handle.
updatedRangesThe ranges of the buffer that were updated.
Since
Kanzi 4.0.0

◆ create() [1/16]

KANZI_GFX_API HandleGuard< BufferHandle > kanzi::gfx::create ( const BufferCreateInfo & info)

Creates a buffer graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new buffer object.
Since
Kanzi 4.0.0

◆ create() [2/16]

KANZI_GFX_API HandleGuard< ImageHandle > kanzi::gfx::create ( const ImageCreateInfo & info)

Creates an image graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new image object.
Since
Kanzi 4.0.0

◆ create() [3/16]

Creates a frame buffer graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new frame buffer object.
Since
Kanzi 4.0.0

◆ create() [4/16]

Creates a vertex input state graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new vertex input state object.
Since
Kanzi 4.0.0

◆ create() [5/16]

Creates a depth stencil state graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new depth stencil state object.
Since
Kanzi 4.0.0

◆ create() [6/16]

Creates a blend state graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new blend state object.
Since
Kanzi 4.0.0

◆ create() [7/16]

Creates a raster state graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new raster state object.
Since
Kanzi 4.0.0

◆ create() [8/16]

Creates a render resource set graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new render resource set object.
Since
Kanzi 4.0.0

◆ create() [9/16]

Creates a compute resource set graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new compute resource set object.
Since
Kanzi 4.0.0

◆ create() [10/16]

Creates a sampler graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new sampler object.
Since
Kanzi 4.0.0

◆ create() [11/16]

KANZI_GFX_API HandleGuard< ShaderHandle > kanzi::gfx::create ( const ShaderCreateInfo & info)

Creates a shader graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new shader object.
Since
Kanzi 4.0.0

◆ create() [12/16]

Creates a compute pipeline graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new compute pipeline object.
Since
Kanzi 4.0.0

◆ create() [13/16]

Creates a render pipeline graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new render pipeline object.
Since
Kanzi 4.0.0

◆ create() [14/16]

Creates a render pass graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new render pass object.
Since
Kanzi 4.0.0

◆ create() [15/16]

Creates a command buffer graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new command buffer object.
Since
Kanzi 4.0.0

◆ create() [16/16]

Creates a GPU fence graphics object.

You can call this function from any thread.

Parameters
infoThe initialization parameters.
Returns
A reference counted handle to the new GPU fence object.
Since
Kanzi 4.0.0

◆ getStatus() [1/2]

KANZI_GFX_API ObjectStatus kanzi::gfx::getStatus ( const ShaderHandleGuard & handle)

Gets the status of a shader graphics object.

You can call this function from any thread.

Parameters
handleThe shader handle.
Returns
An object status for the shader.
Since
Kanzi 4.0.0

◆ getStatus() [2/2]

KANZI_GFX_API ObjectStatus kanzi::gfx::getStatus ( const RenderPipelineHandleGuard & handle)

Gets the status of a render pipeline graphics object.

You can call this function from any thread.

Parameters
handleThe render pipeline handle.
Returns
An object status for the render pipeline.
Since
Kanzi 4.0.0

◆ peekCommandBufferMemory()

KANZI_GFX_API span< const byte > kanzi::gfx::peekCommandBufferMemory ( const CommandBufferHandleGuard & handle)

Peeks at the currently allocated memory inside a command buffer.

You can call this function from any thread. You cannot allocate and peek at memory for the same command buffer from multiple threads at the same time.

Parameters
handleThe command buffer handle.
Returns
A span of bytes that have previously been allocated for the command buffer.
Since
Kanzi 4.0.0

◆ getPixelStride()

KANZI_GFX_API uint32_t kanzi::gfx::getPixelStride ( Format format)

Gets the pixel stride in bytes for an uncompressed graphics format.

Parameters
formatThe graphics format.
Returns
The stride in bytes.
Since
Kanzi 4.0.0

◆ getBlockStride()

KANZI_GFX_API uint32_t kanzi::gfx::getBlockStride ( Format format)

Gets the block stride in bytes for a compressed graphics format.

Parameters
formatThe compressed graphics format.
Returns
The stride in bytes.
Since
Kanzi 4.0.0

◆ getChannelCount()

KANZI_GFX_API uint32_t kanzi::gfx::getChannelCount ( Format format)

Gets the number of color and alpha channels in a graphics format.

Parameters
formatThe graphics format.
Returns
The number of channels.
Since
Kanzi 4.0.0

◆ isColor()

KANZI_GFX_API bool kanzi::gfx::isColor ( Format format)

Returns whether a graphics format contains a color channel.

Parameters
formatThe graphics format.
Returns
If the format contains a color channel, true, otherwise false.
Since
Kanzi 4.0.0

◆ isAlpha()

KANZI_GFX_API bool kanzi::gfx::isAlpha ( Format format)

Returns whether a graphics format contains an alpha channel.

Parameters
formatThe graphics format.
Returns
If the format contains an alpha channel, true, otherwise false.
Since
Kanzi 4.0.0

◆ isDepth()

KANZI_GFX_API bool kanzi::gfx::isDepth ( Format format)

Returns whether a graphics format contains a depth channel.

Parameters
formatThe graphics format.
Returns
If the format contains a depth channel, true, otherwise false.
Since
Kanzi 4.0.0

◆ isStencil()

KANZI_GFX_API bool kanzi::gfx::isStencil ( Format format)

Returns whether a graphics format contains a stencil channel.

Parameters
formatThe graphics format.
Returns
If the format contains a stencil channel, true, otherwise false.
Since
Kanzi 4.0.0

◆ isSRGBEncoded()

KANZI_GFX_API bool kanzi::gfx::isSRGBEncoded ( Format format)

Returns whether the color channels of a graphics format are sRGB-encoded.

Parameters
formatThe graphics format.
Returns
If the format contains sRGB-encoded color channels, true, otherwise false.
Since
Kanzi 4.0.0

◆ isCompressed()

KANZI_GFX_API bool kanzi::gfx::isCompressed ( Format format)

Returns whether a graphics format is compressed.

Parameters
formatThe graphics format.
Returns
If the format is compressed, true, otherwise false.
Since
Kanzi 4.0.0

◆ isAstcHdrCompressed()

KANZI_GFX_API bool kanzi::gfx::isAstcHdrCompressed ( Format format)

Returns whether a graphics format is ASTC HDR compressed.

Parameters
formatThe graphics format.
Returns
If the format is ASTC HDR compressed, true, otherwise false.
Since
Kanzi 4.0.0

◆ getFormatAspects()

KANZI_GFX_API AspectMask kanzi::gfx::getFormatAspects ( Format format)

Gets the aspect mask for a given graphics format.

Parameters
formatThe graphics format.
Returns
The aspect mask.
Since
Kanzi 4.0.0

◆ getColorBits()

KANZI_GFX_API v4u8 kanzi::gfx::getColorBits ( Format format)

Gets the number of bits used to represent each color and alpha channel.

Parameters
formatThe graphics format.
Returns
Vector of four unsigned integers representing the bit depth of the color and alpha channels.
Since
Kanzi 4.0.0

◆ getDepthStencilBits()

KANZI_GFX_API v2u8 kanzi::gfx::getDepthStencilBits ( Format format)

Gets the number of bits used to represent each depth and stencil channel.

Parameters
formatThe graphics format.
Returns
Vector of two unsigned integers representing the bit depth of the depth and stencil channels.
Since
Kanzi 4.0.0

◆ getBlockSize()

KANZI_GFX_API v2u8 kanzi::gfx::getBlockSize ( Format format)

Gets the block size in pixels of a compressed format.

Parameters
formatThe graphics format.
Returns
Vector of two unsigned integers representing the block size in pixels.
Since
Kanzi 4.0.0

◆ formatToChannelType()

KANZI_GFX_API ChannelType kanzi::gfx::formatToChannelType ( Format format)

Gets the channel encoding type for a graphics format.

Parameters
formatThe graphics format.
Returns
The channel type used by the graphics format.
Since
Kanzi 4.0.0

◆ getImageSize()

KANZI_GFX_API size_t kanzi::gfx::getImageSize ( Format format,
v3u32 dimensions )

Gets the size in bytes of an image with the specified format and dimensions.

Parameters
formatthe graphics format.
dimensionsThe image dimensions.
Returns
The size of the image in bytes.
Since
Kanzi 4.0.0

◆ getIndexBufferStride()

uint32_t kanzi::gfx::getIndexBufferStride ( IndexBufferType type)
inline

Gets the stride in bytes of an index buffer type.

Parameters
typeThe index buffer type.
Returns
The stride in bytes.
Since
Kanzi 4.0.0

◆ getFaceCount()

uint8_t kanzi::gfx::getFaceCount ( gfx::ImageType type)
inline

Gets the face count for a given resource type.

Parameters
typeResource type.
Returns
Number of faces.
Since
Kanzi 4.0.0

◆ toFixedString()

KANZI_GFX_API FixedString kanzi::gfx::toFixedString ( FilterMode filter)

Gets a string representation of a filter mode.

Parameters
filterThe filter mode.
Returns
A string representation of the filter mode.
Since
Kanzi 4.0.0

◆ calculateDimensionsForMip() [1/2]

constexpr v2u32 kanzi::gfx::calculateDimensionsForMip ( v2u32 dims,
uint8_t mip )
constexpr

Calculates the dimensions of a 2-dimensional mip level.

Parameters
dimsThe original size of the image.
mipThe mip level whose dimensions to calculate.
Returns
The dimensions of the mip level.
Since
Kanzi 4.0.0

◆ calculateDimensionsForMip() [2/2]

constexpr v3u32 kanzi::gfx::calculateDimensionsForMip ( v3u32 dims,
uint8_t mip )
constexpr

Calculates the dimensions of a 3-dimensional mip level.

Parameters
dimsThe original size of the image.
mipThe mip level whose dimensions to calculate.
Returns
The dimensions of the mip level.
Since
Kanzi 4.0.0

◆ tryGetFormatFromSurfaceBits()

Format kanzi::gfx::tryGetFormatFromSurfaceBits ( const platform::SurfaceBits & properties)
inline

Matches a SurfaceBits structure to a graphics format.

Parameters
propertiesThe surface bits description.
Returns
The graphics format that matches the surface bits.
Since
Kanzi 4.0.0

◆ tryGetDepthStencilFromSurfaceBits()

Format kanzi::gfx::tryGetDepthStencilFromSurfaceBits ( const platform::SurfaceBits & properties)
inline

Matches a SurfaceBits structure to a depth stencil graphics format.

Requires KzGfx to be initialized to query format support from target.

Parameters
propertiesThe surface bits description.
Returns
The depth stencil graphics format that matches the surface bits.
Since
Kanzi 4.0.0

◆ getSurfaceBitsFromFormat()

KANZI_GFX_API platform::SurfaceBits kanzi::gfx::getSurfaceBitsFromFormat ( Format color,
Format depthStencil = Format::None )

Converts a color and depth stencil Format into a SurfaceBits structure.

Parameters
colorThe color format. Must be Format::None or an uncompressed format with color channels.
depthStencilThe depth stencil format. Must be Format::None or a format with either depth or stencil channels.
Returns
The SurfaceBits struct to represent the color and depthStencil format.
Since
Kanzi 4.0.0

◆ getShaderFormatFamily()

constexpr ShaderFormatFamily kanzi::gfx::getShaderFormatFamily ( ShaderFormat format)
constexpr

Gets the Shader format family for a given shader format.

Parameters
formatThe shader format.
Returns
The shader format family for the given shader format.
Since
Kanzi 4.0.0

◆ toString() [1/4]

KANZI_GFX_API string kanzi::gfx::toString ( ShaderStage stage)

Gets the shader stage as a string.

Parameters
stageThe shader stage.
Returns
The shader stage string.
Since
Kanzi 4.0.0

◆ toString() [2/4]

KANZI_GFX_API string kanzi::gfx::toString ( DevicePropertyId propertyId)

Gets the device property identifier as a string.

Parameters
propertyIdThe device property identifier.
Returns
The device property identifier string.
Since
Kanzi 4.0.0

◆ toString() [3/4]

KANZI_GFX_API string kanzi::gfx::toString ( FeatureId feature)

Gets the Feature identifier as a string.

Parameters
featureThe feature identifier.
Returns
The feature identifier string.
Since
Kanzi 4.0.0

◆ toString() [4/4]

KANZI_GFX_API string kanzi::gfx::toString ( ShaderFormat format)

Gets the shader format as a string.

Parameters
formatThe shader format.
Returns
The shader format string.
Since
Kanzi 4.0.0

◆ visitCommands()

template<typename T_Func >
void kanzi::gfx::visitCommands ( const span< const byte > & commandMemory,
T_Func && func )

Traverses the command memory.

Parameters
commandMemoryThe command buffer memory.
funcThe callback to call for each command.
Template Parameters
T_FuncThe function object called for every command, with the command as a reference argument.